#ifndef P_TRANSFORM_COMPONENT_H
#define P_TRANSFORM_COMPONENT_H

#include "ECS/Component/PComponent.h"
#include "Graphics/PiccoloGraphicsContext.h"

namespace Piccolo
{
    class PTransformComponent : public PComponent
    {
    public:
        glm::vec3 position{0.f, 0.f, 0.f};
        glm::vec3 rotation{ 0.f, 0.f, 0.f };
        glm::vec3 scale{ 1.f, 1.f, 1.f };

        glm::mat4 GetTransformMatrix() const
        {
            glm::mat4 translateMatrix = glm::translate(glm::mat4(1.f), position);
            glm::mat4 rotationMatrix = glm::rotate(glm::mat4(1.f), glm::radians(rotation.x), glm::vec3{ 1.f, 0.f, 0.f });
            rotationMatrix = glm::rotate(rotationMatrix, glm::radians(rotation.y), glm::vec3{ 0.f, 1.f, 0.f });
            rotationMatrix = glm::rotate(rotationMatrix, glm::radians(rotation.z), glm::vec3{ 0.f, 0.f, 1.f });
            glm::mat4 scaleMatrix = glm::scale(glm::mat4(1.f), scale);
            return translateMatrix * rotationMatrix * scaleMatrix;
        }
    };
}

#endif